import { mapGetters, mapActions } from "vuex";
export default {
  name: "mobile",
  methods: mapActions(["toggleDevice"]),
  beforeMount() {
    const { body } = document;
    const WIDH = 768;
    const RATIO = 3;
    const handler = () => {
      if (!document.hidden) {
        let rect = body.getBoundingClientRect();
        let isMobile = rect.width - RATIO < WIDH;
        this.toggleDevice(isMobile ? "mobile" : "other");
      }
    };
  }
};
